﻿/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef GAME_GAME_DBCSTRUCTURE_H_
#define GAME_GAME_DBCSTRUCTURE_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

/************************************************************************/
/* DBC配置结构                                                          */
/************************************************************************/

#include <cstdint>
#include "Game/Game/DBCEnum.h"

#if defined( __GNUC__ )
#pragma pack(1)
#else
#pragma pack(push,1)
#endif

/* 种族定义 */
struct ChrRacesEntry
{
	std::uint32_t      RaceID;                  /* 种族ID */
	std::uint32_t      FactionID;               /* 派系ID */
	std::uint32_t      Model_M;                 /* 男性模型ID */
	std::uint32_t      Model_F;                 /* 女性模型ID */
	std::uint32_t      TeamID;                  /* 阵营ID(7-Alliance 1-Horde) */
	std::uint32_t      StartingTaxiMask;        /* 起始飞行点标志 */
	std::uint32_t      CinematicSequence;       /* 影片ID */
	char*              Name[8];                 /* 种族名字 */
};

/* 职业定义 */
struct ChrClassesEntry
{
	std::uint32_t  ClassID;                     /* 职业ID */
	std::uint32_t  PowerType;                   /* 能量类型 */
	char const* Name[8];                        /* 职业名字 */
	std::uint32_t  SpellFamily;                 /* 魔法族系 */
};

/* 地图 */
struct MapEntry
{
    std::uint32_t  MapID;                                          // 0        m_ID
    std::uint32_t  MapType;                                        // 2        m_InstanceType
    char*   Name[8];                                               // 4-11     m_MapName_lang
    std::uint32_t  LinkedZone;                                     // 19       m_areaTableID
    std::uint32_t  MultimapId;                                     // 38       m_LoadingScreenID (LoadingScreens.dbc)
    
    // Helpers

    bool IsDungeon(void) const { return MapType == MAP_INSTANCE || MapType == MAP_RAID; }
    bool IsNonRaidDungeon(void) const { return MapType == MAP_INSTANCE; }
    bool Instanceable(void) const { return MapType == MAP_INSTANCE || MapType == MAP_RAID || MapType == MAP_BATTLEGROUND; }
    bool IsRaid(void) const { return MapType == MAP_RAID; }
    bool IsBattleGround(void) const { return MapType == MAP_BATTLEGROUND; }
    bool IsMountAllowed(void) const { return !IsDungeon() || MapID == 309 || MapID == 209 || MapID == 509 || MapID == 269; }
    bool IsContinent(void) const { return MapID == 0 || MapID == 1; }
};

#if defined( __GNUC__ )
#pragma pack()
#else
#pragma pack(pop)
#endif

#endif /* GAME_GAME_DBCSTRUCTURE_H_ */
